Text Tidier 1.1 by Dave Yearke modified by Warren Lieuallen As you may recall, we received from a Dutch users' group Turbo BASIC, a language for the XL/XE computers which is compatible with Atari BASIC but offers over 60 new features and is three times faster. Well, they've done it again, this time they sent us the Turbo BASIC Compiler, a program which compiles BASIC programs so they run three times faster than Turbo BASIC! I wanted to write a program to demonstrate the power of these two new programs, so after a few nights of work, Text Tidier was born. Text Tidier was designed to eliminate much of the editing that goes into processing files downloaded from such services as CompuServe. These files often have excess spaces for justification, carriage returns every line, and all kinds of other annoying things that must be weeded out. The most bothersome types of text files are those which use the Control-J Control-M combination for linefeed and carriage return. For MS-DOS machines that's fine, but our Ataris use a totally different character. In its simplest form, Tidier strips out linefeeds (^J) and turns ASCII carriage returns (^M) into ATASCII returns (code 155). It also breaks down the file into smaller pieces that will fit into a word processor like AtariWriter or PaperClip. I've downloaded files that were over 100K long, far too big to fit into any word processor for the Atari! When you run the program, the first thing it asks for is the maximum file size for the output files. 12,000 is pretty good for AtariWriter, although this depends on what DOS is being used, whether a printer driver is loaded, and so on. For PaperClip, I've found that on my XL about 24,000 bytes can be loaded, although I would recommend about 20,000 so you have room to edit the file. In version 1.1, this question is by-passed; the maximum file size is automatically set to 12,000 for AtariWriter conversions, 20,000 for PaperClip conversions, and 10,000 for no conversion. Next it asks for the Input file. Put the disk in the drive and enter the name. If you don't enter a device like "D:" it will default to drive one. In version 1.0, all Output files will be named "SPLIT.0xx", where "xx" is the number of the file being written, starting at zero. Be careful not to overwrite any existing files with the same name! In version 1.1, the filename routines are more flexible. Any filename is allowable, with the input filename being the default (so it WILL overwrite the older input file). If a new name is selected, the extension of .0xx is provided by the program (as described above), unless the user specifies an extension in the filename entered. If that is the case, that extension will be used. Now come the formatting parameters. When it asks "CONVERT RETURN TO SPACE (Y/N)" type "Y" if you want all carriage returns to be converted. This is nice if you want to reformat the text in your word processor. This option only converts single returns; if it encounters more after the first one it will leave them alone because it assumes that it is a break between two paragraphs. The next option, "TIDY UP SPACING (Y/N)", is probably the most powerful. It will get rid of multiple spaces between words, excess spaces before return characters, convert ASCII Tab characters (^I) to 5 spaces, and will make sure that two spaces follow all periods, colons, question marks, and exclamation points, and that one space follows all commas, even if it has to add them. One note: it will not add spaces to periods which have no spaces after them, because it can't tell if it is part of a decimal number. The next option, "PROMPT BEFORE WRITING (Y/N)", should get a "Y" response if you need to switch disks between reading and writing, and an "N" response if you want to let it go without interruption. The "BREAK FILES ON SPACE (Y/N)" simply assures that a word won't be split over two files (this may not work if the last word before writing is over 15 characters long, but that's pretty rare). The last option is a convenience to those with the AtariWriter or PaperClip word processors. If you select either "A" or "P" at the prompt, it will write the "chain next file" command at the end of all files except the last one. In addition, it will put a paragraph symbol where it thinks it's appropriate, and convert the ASCII formfeed character (^L) to its AW or PC equivalent. If you select "N" for "neither", then the paragraphs will be indented five spaces and formfeeds will be left alone. By the way, the program only allows character codes within the range 26-127, plus CR (13) and FF(12). Characters higher than 127 have the high bit stripped to make them "normal," while control characters are ignored. If you want to allow inverse and control characters (although this can be a potential problem with true ASCII files; control characters can have bizarre meanings, and true ASCII does not allow character codes higher than 127. If you get any, it's probably a transmission error), change line 215 to: 215 REPEAT :GET #1,N:UNTIL (N<>LF) This will only filter linefeed characters. This program was written out of necessity, but I h>also had a lot of fun doing it. If you have any questions, comments, or suggestions, please let me know (Dave Yearke can be found lurking at the meetings or on BATES in the "Ask Dave Y!" message base. Warren Lieuallen can be found on the ACEC BBS [614-268-0405], or on CompuServe at 73177,1502.). I'd like to correct any bugs you find (gasp!) quickly, and any features I haven't thought of we'll make part of Text Tidier 2.0! bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb